package com.ibeeking.found.org.b.rest.controller.v1.feign;

import com.ibeeking.found.common.entity.EmployeeDTO;
import com.ibeeking.found.common.entity.SimpleEmployeeDTO;
import com.ibeeking.found.common.entity.query.EmployeeFeignQuery;
import com.ibeeking.found.org.b.rest.service.IEmployeeService;
import com.ibeeking.nematos.constants.enums.OperateLogTypeEnum;
import com.ibeeking.nematos.log.annotation.Log;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName  EmployeeFeignController
 * @Description
 * @Author ibeeking
 * @Date 2021-01-07 12:58
 **/
@RestController
@RequestMapping("/b/employee/feign/v1")
public class EmployeeFeignController {

    @Resource
    private IEmployeeService employeeServiceImpl;

    /**
     * @param query
     * @return
     */
    @Log(logType = OperateLogTypeEnum.QUERY, describe = "查询员工")
    @PostMapping(value = "/queryEmployeeList")
    public List<EmployeeDTO> queryEmployeeList(@RequestBody EmployeeFeignQuery query) {
        return employeeServiceImpl.feignQueryEmployeeList(query);
    }
    /**
     * @param employeeId
     * @return
     */
    @Log(logType = OperateLogTypeEnum.QUERY, describe = "查询员工")
    @PostMapping(value = "/queryEmployee/{employeeId}")
    public SimpleEmployeeDTO queryEmployee(@PathVariable("employeeId") Long employeeId) {
        return employeeServiceImpl.feignQueryEmployee(employeeId);
    }

}